The present invention relates to monitoring program execution in a visual programming environment, such as to enable debugging.
Visual programming techniques and tools allow computer programs to be developed by manipulation of visual images representing objects, providing an alternative to conventional alphanumeric-character-based programming languages. Such techniques and tools make the task of computer program development easier for programmers than was possible with earlier non-visual programming languages, and make programming accessible to non-expert programmers. Visual programming has enabled more rapid prototyping and application program development, and has generally enabled users to focus on what functions they want their program to perform by greatly reducing the requirement to learn about programming languages and the internal workings of a computer.
Nevertheless, it remains the case that the available visual programming tools and languages, such as VisualBasic from Microsoft Corporation, are mainly used for building a user interface (selecting and positioning user interface components such as buttons, scrollbars, etc, and scripting their behaviour). The user is often required to rely on conventional programming techniques for implementing the main business logic underneath the user interface.
As with other computer programs, programs developed using visual programming techniques require debugging, but in the past many visual programming tools have not enabled visual debugging. That is, the user has been provided with source level debug information which has required a greater level of understanding of languages and systems than the original visual programming task. More recently, it has been recognised that visual programmers should be provided with visual reporting of any problems which require debugging, thereby matching the problem reporting style to the requirements of a typical visual programmer rather than relying on non-intuitive source code level debug information.
PROGRAPH 2, described in Cox et al, xe2x80x9cUsing a Pictorial Representation to Combine Dataflow and Object-Orientation in a Language Independent programming Mechanismxe2x80x9d, Proceedings International Computer Science Conference, pp. 695-704, 1988, is one example of a visual programming environment which has integrated editing and debugging, and in which operations are represented pictorially as nodes of an hierarchical dataflow. Sets of windows can be opened to explore different levels of detail within a program and errors are responded to by opening a window containing the operation in question, flashing the relevant icon and generating an explanatory message.
To enable debugging of an hierarchical program, PROGRAPH 2 and other known visual programming tools rely on access to the program""s execution stack to monitor execution of the program and hence to indicate the hierarchical structure and locations within it. A program""s execution stack is the data area or buffer of the data processing apparatus on which the program is executing which is used for storing context information for the sequence of invocations for operations that are performed during execution of the program. Storing such context information during program execution is essential for successful execution of an hierarchical (or nested) programxe2x80x94to enable a program which jumps to a subroutine to return to the correct point in the program after executing the subroutine. The reliance of known debuggers on the execution stack is because an hierarchical program is typically xe2x80x9cflattenedxe2x80x9d into a linear flow for execution, such that the context within the hierarchical structure of a particular point in a program is not apparent from the executing program itself (subroutines appear as macros within a linear flow). An interpreter within PROGRAPH 2 shows the state of the execution stack in a special window and can illustrate the executing operations via a set of windows showing different levels of the hierarchy. This is fine for typical visual programmers, because their programs are limited to a single system and the program execution stack is available on the same system as the development and debugging tools. However, such a debugging solution could not be used if the execution stack is inaccessible from the debugger.
Another solution which allows debugging of dataflow diagrams in a unified visual environment without repeatedly switching between build and debug modes of operation is the PANTA development framework from Metrowerks AG (formerly HIWARE AG). The user merely switches between edit and debug windows.
U.S. Pat. No. 6,055,369 discloses a visual programming apparatus for creating a program with a visual user interface made up of multiple screens, including a unit for creating a screen flow comprising a flow of processes which includes a compressed representation of each of the multiple screens. Information can be extracted from the screen flow and used to generate source code. This assists the user in understanding the association between screens and hence designing, creating and testing a visual program.
U.S. Pat. No. 5,850,548 discloses a visual programming environment based on an hierarchical data flow model. Functional code components can be constructed either using conventional programming techniques or using a visual programming language, and these components are then connected together in an hierarchical data flow model for sending messages to and receiving messages from each other. The on-screen representation of the data flow aids debugging.
According to a first aspect of the present invention, there is provided a visual execution monitoring tool for monitoring execution of an hierarchical visual program, comprising: one or more components for generating program execution progress reports upon reaching predefined stages of program execution, and for sending the reports to an execution monitoring controller; an execution monitoring controller for maintaining information representing the hierarchical structure of the hierarchical visual program and for mapping received progress report data to the hierarchical program structure; and means for generating, during execution of said visual program, a visual representation of the hierarchical program structure and a visual representation of the position within the hierarchical program structure corresponding to the stage of program execution indicated by the received progress report data.
The execution monitoring controller preferably maintains an updated record of certain parts of the program""s execution stack, updated from received execution progress reports. This preferably provides, in a storage area local to a debugger, the context of operation execution required for debugging the program. The sending of reports to the execution monitoring controller may be implemented by, for example, use of TCP/IP socket connections or storing reports on a storage medium which is accessible to both the execution progress report generator components and the execution monitoring controller, or an alternative.
According to the invention, the structure of an hierarchical visual program can be displayed during test execution to facilitate debugging. This is particularly useful for monitoring execution of an hierarchical program which is executing on a separate system from the execution monitoring controller, since the monitoring controller will not then have access to the hierarchical program""s execution stack and it is undesirable to have to rely on accessing a remote system""s log records to track execution progress. The invention will also prove useful for monitoring execution of a distributed hierarchical program in which processing components of the program are executable remotely from each other, since no single system""s program execution stack would then provide the full context within the program hierarchy.
According to a preferred embodiment of the invention, the visual representation of the hierarchical visual program represents processing components of the visual program as interconnected nodes of an hierarchical program flow. The components for generating progress reports are preferably also implemented as separate nodes of the program flow. This consistency between progress report generator components and processing components allows a visual programmer to use consistent visual programming techniques and concepts (manipulation of visual representations of separate components) to work with both types of components. Furthermore, if the execution system is separate from but connected to the system used for programming, then no change will be required to the program""s execution system to handle the addition of report generator nodes and the report generator nodes need not be exposed to a normal user when the program is run.
In a preferred embodiment of the invention, the monitoring tool automatically instruments the program flow with progress report generator nodes, in response to analysing the program to identify certain program execution stages. This automated insertion of report generator nodes reduces the work involved in enabling execution monitoring.
The visual programmer is preferably provided with the capability to set breakpoints within the program at the positions of selected report generator nodesxe2x80x94for example at input or output terminals of processing nodes, on connections between nodes, or other significant points in the program flow. Setting of breakpoints is well known within visual programming.
The progress report generator nodes preferably include debug nodes which generate execution progress data for debugging, and the execution progress monitoring controller comprises a debug controller adapted to determine the position within an hierarchical program structure corresponding to the current state of program execution and to visually display debug information with an indication of the determined position.
A tool according to a preferred embodiment of the present invention is a visual programming and execution monitoring tool for developing message processing and forwarding programs, in which the processing components are represented as nodes of a visual message flow. The message flow can be debugged by executing it on a test and debug system which is connected for communication with a development system. Run-time execution can be simulated by inputting test messages to the message flow, sending execution progress reports to an execution monitoring controller, and using the controller to monitor processing of these messages and display the results to the programmer. The processing components of the test and debug execution system may be distributed across a plurality of interconnected data processing systems. In an environment in which program components may be executing on one or more systems remote from a debugger, prior art debugging solutions which rely on access to a single system""s execution stack cannot be used and the alternative of a debugger which relies on accessing the log records of a remote different system would not achieve desirable performance.
According to the preferred embodiment, program development capability including debug editing capability is integrated with the execution monitoring tool, such that development and debugging can be performed without switching modes between execution monitoring and editing and without switching from a development system to an unconnected, dedicated debugging system.
A programmer wishing to debug a visual program which is represented by a message flow provides a set of input messages (for example, the programmer either defines messages, selects predefined messages or runs communicating partner test applications to generate messages), uses the execution monitoring tool to monitor the actions performed on the message during execution, and responds to any visual indications of the occurrence of exceptions by editing the program using visual programming techniques. The structure and contents of the message can preferably be tracked at all points in the execution of the message flow and the visual program can be developed, monitored and edited within the integrated development and debugging environment until it has been verified as working properly.
Furthermore, according to the preferred embodiment, the user""s view of the visual message flow representation of the developed program is consistent with the user""s understanding of messages flowing between nodes of a message processing and forwarding network, and this minimizes the requirement for a visual programmer who is familiar with messaging to learn new concepts before starting programming of message flows.
Such a visual programming and execution monitoring tool can be integrated within a message broker within a messaging network, or provided as a tool for use with such a broker. This is particularly advantageous since message brokers can provide a very valuable intermediary message processing and forwarding service for application programs connected via a messaging network, particularly in complex networks, and yet message brokers are required to perform different sets of operations for different enterprises and users and different enterprises will have very different combinations of new and legacy systems which are required to interoperate via the message broker. It is therefore particularly beneficial to provide visual programming and debugging capability to enable rapid customisation of the broker and integration with other systems. A message broker framework supporting modular plug and play components can benefit greatly from the present invention. Furthermore, enterprises who have a message broker in productive use for routing and transforming messages will typically prefer a runtime simulation or execution on a test and debugging system which is integrated within the development environment, rather than extending their run-time production system. This is preferred both to optimize the performance of their developers and to protect their business-critical production system from programming errors.
According to preferred embodiments of the present invention, a debug controller maintains an hierarchical representation of an hierarchical program during a simulated execution and maps execution progress report data to this representation. The progress reports are sent to this controller from remotely executing components (and also from any components executing on the same system as the controller). This can be thought of as resynthesizing, in a storage area local to the debug controller, those parts of a program""s execution stack which are required for debugging the program. A visual representation of the progress report data is displayed with a visual indication of the context within the hierarchy of the visual program. The programmer can then edit the program within the context of the debugging task if the progress report data indicates the occurrence of exceptions.
In a second aspect, the invention provides a method for monitoring execution progress of an hierarchical visual program, including the steps of: storing information representing the hierarchical structure of the hierarchical visual program; identifying a set of locations within the hierarchical visual program corresponding to a predefined set of execution progress points, and inserting at each of said locations a component for generating program execution progress reports when the predefined execution progress points are reached during execution; initiating execution of the hierarchical visual program in response to user input; monitoring execution of the hierarchical visual program, including responding to said components generating said execution progress reports by sending the progress reports to an execution monitoring controller which maps received progress report data to the hierarchical program structure; and generating, during execution of said visual program, a visual representation of the hierarchical program structure and a visual representation of the position within the hierarchical program structure corresponding to the stage of program execution indicated by the received progress report data.
In a third aspect, the invention provides a computer program (preferably implemented as a computer program product comprising program code recorded on a computer readable recording medium) for controlling a data processing apparatus on which it runs to perform a method as above.
A computer program product according to the invention, which comprises program code recorded on a computer-readable recording medium, may implement a visual execution monitoring tool for monitoring execution of an hierarchical visual program in which the program code of the tool comprises: one or more components for generating program execution progress reports upon reaching predefined stages of program execution, and for sending the reports to an execution monitoring controller; an execution monitoring controller for maintaining information representing the hierarchical structure of the hierarchical visual program and for mapping received progress report data to the hierarchical program structure; and means for generating, during execution of said visual program, a visual representation of the hierarchical program structure and a visual representation of the position within the hierarchical program structure corresponding to the stage of program execution indicated by the received progress report data.